edfbdf2748f7abe0bcccd00893c37bb007dfc036,modules/ingest-grok/src/test/java/org/elasticsearch/ingest/grok/GrokProcessorTests.java,GrokProcessorTests,testMissingField,#,85

Before Change


    public void testMissingField() {
        String fieldName = "foo.bar";
        IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
        Grok grok = new Grok(Collections.singletonMap("ONE", "1"), "%{ONE:one}");
        GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), grok, fieldName);
        try {
            processor.execute(doc);
            fail();
        } catch (Exception e) {
            assertThat(e.getMessage(), equalTo("field [foo] not present as part of path [foo.bar]"));

After Change


    public void testMissingField() {
        String fieldName = "foo.bar";
        IngestDocument doc = RandomDocumentPicks.randomIngestDocument(random(), new HashMap<>());
        GrokProcessor processor = new GrokProcessor(randomAsciiOfLength(10), Collections.singletonMap("ONE", "1"),
            Collections.singletonList("%{ONE:one}"), fieldName);
        Exception e = expectThrows(Exception.class, () -> processor.execute(doc));
        assertThat(e.getMessage(), equalTo("field [foo] not present as part of path [foo.bar]"));
    }